Overview
DevolutionSync implements a secure authentication system with role-based access control (RBAC), session management, and automatic security measures to protect enterprise data.Admin
Full system access with approval authority
Auxiliary
Register and manage product returns
Consultation
Read-only access to system data
Role-Based Access Control
The system defines three user roles (grades) with distinct permissions:- Admin (Grade 1)
- Auxiliary (Grade 2)
- Consultation (Grade 3)
Permissions:
- Access to dashboard and analytics
- Review and approve/reject returns
- View complete system history
- Manage authorization codes
index.php?url=home/indexLogin Process
Credential Validation
The system queries the database to validate the credentials and retrieve the user’s role.
Session Creation
Upon successful authentication, a secure session is created with user details and timestamps.
Implementation
The authentication flow is handled by theAuthController class:
controllers/AuthController.php
The
session_regenerate_id(true) call prevents session fixation attacks by generating a new session ID after successful login.Session Management
Session Variables
The system stores the following data in the PHP session:| Variable | Description | Example |
|---|---|---|
user | Username identifier | ANALISTA |
nombre | Full name of the user | SEBASTIAN OBANDO |
grado | Role level (1-3) | 1 |
logged_in | Authentication flag | true |
last_activity | Timestamp of last action | 1709654400 |
Session Initialization
Every controller initializes the session and verifies authentication:controllers/PanelController.php
Database Structure
User credentials are stored in theusuarios table:
Script_BD/Script_DB.sql
User Lookup
TheAuthModel handles database queries:
models/AuthModel.php
Logout Process
The logout function destroys the session and redirects to the login page:controllers/AuthController.php
Security Features
Session Regeneration
Session Regeneration
After successful login, the system calls
session_regenerate_id(true) to prevent session fixation attacks.Role Verification
Role Verification
Every protected controller validates both authentication status and role permissions before allowing access.
Activity Tracking
Activity Tracking
The
last_activity session variable enables session timeout implementation to automatically log out inactive users.Prepared Statements
Prepared Statements
All database queries use PDO prepared statements to prevent SQL injection attacks.
Default Users
The system includes three default users for testing:Script_BD/Script_DB.sql
Change default passwords immediately after installation for security.
Next Steps
Return Management
Learn how Auxiliary users register product returns
Approval Workflow
Understand the admin review and approval process